<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class WxExceptional extends Model
{
    use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'wx_exceptional';


    public function user()
    {
        return $this->hasOne(WxUser::class, "id", "user_id");
    }

    public function euser()
    {
        return $this->hasOne(WxUser::class, "id", "posts_user_id");
    }

    public function addExceptional($uid, $posts_id, $posts_user_id, $exceptional_price)
    {

        $this->user_id = $uid;
        $this->posts_id = $posts_id;
        $this->posts_user_id = $posts_user_id;
        $this->exceptional_price = $exceptional_price;
        $this->save();
    }
}
